#!/bin/sh


# potentially dangerous expr : (eval|exec|execfile)\(|eval\s*in

line="***************************************************************"

echo -e "\n\n$line"
echo -e "*****        Lancement des doctests                    *****"
echo -e "$line\n\n"

make doctest

echo -e "\n\n$line"
echo -e "*****  Lancement des tests unitaires                   *****"
echo -e "$line\n\n"

cd doctests
nosetests
cd -

# python -m unittest discover -t doc/ -s doc/tests/ -p "*.py" -v
# nosetests $* -w doctests --with-doctest --doctest-extension='.rst' --doctest-tests --nologcapture


python -c "
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
import doctest
from pyLot.core import Path
for path in Path(u'doctests').walkfiles(u'*.rst'):
  doctest.testfile(path,encoding='utf-8',module_relative=False)
"

#     #module_relative][, name][, package][, globs][, verbose][, report][, optionflags][, extraglobs][, raise_on_error][, parser][, encoding])

